package com.qs.enums;


import java.util.HashMap;
import java.util.Map;

/**
 * 操作类型
 */
public enum ApparatusType {
	FOURH(1, "4h正压呼吸器席位操作"),
	O2(2, "氧气呼吸器校验仪操作"),
	SUSHENGQI(3, "自动苏生器操作"),
	WASI(4, "瓦斯鉴定器操作"),
	CO(5, "一氧化碳鉴定器操作"),
	OTHER(6, "其他仪器操作"),
	ZHENGYAO2(7, "正压氧气呼吸器故障操作");
	
	private int value;
	private String title;

	ApparatusType(int value, String title) {
		this.value = value;
		this.title = title;
	}

    /**
     * 获取枚举值
     * @return 返回枚举值
     */
	public int value() {
		return this.value;
	}

    /**
     * 获取枚举标题
     * @return 返回枚举的标题
     */
	public String title() {
		return this.title;
	}

	private static Map<String, ApparatusType> titlefinder;
	static {
		titlefinder = new HashMap<String, ApparatusType>();
		for (ApparatusType item : ApparatusType.values())
			titlefinder.put(item.title(), item);

	}

	private static Map<Integer, ApparatusType> valuefinder;
	static {
		valuefinder = new HashMap<Integer, ApparatusType>();
		for (ApparatusType item : ApparatusType.values())
			valuefinder.put(new Integer(item.value()), item);

	}

	/**
	 * 按照枚举值查找枚举
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static ApparatusType valueOf(int type) {
		return valuefinder.get(new Integer(type));
	}
	
	/**
	 * 按照枚举标题查找枚举值
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static ApparatusType titleOf(String title) {
		return titlefinder.get(title);
	}
	
	public static ApparatusType[] getMembers() {
		return new ApparatusType[] {FOURH, O2, SUSHENGQI, WASI, CO, OTHER, ZHENGYAO2};
	}
}
